3.8.11 \(\int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) (c-i c \tan (e+f x))} \, dx\) [711]

Optimal. Leaf size=45 \[ \frac {A x}{2 a c}-\frac {\cos ^2(e+f x) (B-A \tan (e+f x))}{2 a c f} \]

[Out]

1/2*A*x/a/c-1/2*cos(f*x+e)^2*(B-A*tan(f*x+e))/a/c/f

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.098, Rules used = {3669, 74, 653, 211} \begin {gather*} \frac {A x}{2 a c}-\frac {\cos ^2(e+f x) (B-A \tan (e+f x))}{2 a c f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*(c - I*c*Tan[e + f*x])),x]

[Out]

(A*x)/(2*a*c) - (Cos[e + f*x]^2*(B - A*Tan[e + f*x]))/(2*a*c*f)

Rule 74

Int[((a_) + (b_.)*(x_))^(m_.)*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[(a*c + b*
d*x^2)^m*(e + f*x)^p, x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && EqQ[b*c + a*d, 0] && EqQ[n, m] && Integer
Q[m] && (NeQ[m, -1] || (EqQ[e, 0] && (EqQ[p, 1] ||  !IntegerQ[p])))

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 653

Int[((d_) + (e_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((a*e - c*d*x)/(2*a*c*(p + 1)))*(a + c*x
^2)^(p + 1), x] + Dist[d*((2*p + 3)/(2*a*(p + 1))), Int[(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x]
&& LtQ[p, -1] && NeQ[p, -3/2]

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {A+B \tan (e+f x)}{(a+i a \tan (e+f x)) (c-i c \tan (e+f x))} \, dx &=\frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(a+i a x)^2 (c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \frac {A+B x}{\left (a c+a c x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {\cos ^2(e+f x) (B-A \tan (e+f x))}{2 a c f}+\frac {A \text {Subst}\left (\int \frac {1}{a c+a c x^2} \, dx,x,\tan (e+f x)\right )}{2 f}\\ &=\frac {A x}{2 a c}-\frac {\cos ^2(e+f x) (B-A \tan (e+f x))}{2 a c f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 43, normalized size = 0.96 \begin {gather*} \frac {-2 B \cos ^2(e+f x)+A (2 (e+f x)+\sin (2 (e+f x)))}{4 a c f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*(c - I*c*Tan[e + f*x])),x]

[Out]

(-2*B*Cos[e + f*x]^2 + A*(2*(e + f*x) + Sin[2*(e + f*x)]))/(4*a*c*f)

________________________________________________________________________________________

Maple [C] Result contains complex when optimal does not.
time = 0.17, size = 82, normalized size = 1.82

method result size
risch \(\frac {A x}{2 a c}-\frac {B \cos \left (2 f x +2 e \right )}{4 a c f}+\frac {A \sin \left (2 f x +2 e \right )}{4 a c f}\) \(54\)
norman \(\frac {\frac {A x}{2 a c}-\frac {B}{2 a c f}+\frac {A \tan \left (f x +e \right )}{2 a c f}+\frac {A x \left (\tan ^{2}\left (f x +e \right )\right )}{2 a c}}{1+\tan ^{2}\left (f x +e \right )}\) \(73\)
derivativedivides \(\frac {-\frac {i A \ln \left (-i+\tan \left (f x +e \right )\right )}{4}-\frac {-\frac {A}{4}-\frac {i B}{4}}{-i+\tan \left (f x +e \right )}+\frac {i A \ln \left (i+\tan \left (f x +e \right )\right )}{4}-\frac {-\frac {A}{4}+\frac {i B}{4}}{i+\tan \left (f x +e \right )}}{f a c}\) \(82\)
default \(\frac {-\frac {i A \ln \left (-i+\tan \left (f x +e \right )\right )}{4}-\frac {-\frac {A}{4}-\frac {i B}{4}}{-i+\tan \left (f x +e \right )}+\frac {i A \ln \left (i+\tan \left (f x +e \right )\right )}{4}-\frac {-\frac {A}{4}+\frac {i B}{4}}{i+\tan \left (f x +e \right )}}{f a c}\) \(82\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f/a/c*(-1/4*I*A*ln(-I+tan(f*x+e))-(-1/4*A-1/4*I*B)/(-I+tan(f*x+e))+1/4*I*A*ln(I+tan(f*x+e))-(-1/4*A+1/4*I*B)
/(I+tan(f*x+e)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [C] Result contains complex when optimal does not.
time = 3.80, size = 61, normalized size = 1.36 \begin {gather*} \frac {{\left (4 \, A f x e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-i \, A - B\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + i \, A - B\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{8 \, a c f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/8*(4*A*f*x*e^(2*I*f*x + 2*I*e) + (-I*A - B)*e^(4*I*f*x + 4*I*e) + I*A - B)*e^(-2*I*f*x - 2*I*e)/(a*c*f)

________________________________________________________________________________________

Sympy [A]
time = 0.19, size = 165, normalized size = 3.67 \begin {gather*} \frac {A x}{2 a c} + \begin {cases} \frac {\left (\left (8 i A a c f - 8 B a c f\right ) e^{- 2 i f x} + \left (- 8 i A a c f e^{4 i e} - 8 B a c f e^{4 i e}\right ) e^{2 i f x}\right ) e^{- 2 i e}}{64 a^{2} c^{2} f^{2}} & \text {for}\: a^{2} c^{2} f^{2} e^{2 i e} \neq 0 \\x \left (- \frac {A}{2 a c} + \frac {\left (A e^{4 i e} + 2 A e^{2 i e} + A - i B e^{4 i e} + i B\right ) e^{- 2 i e}}{4 a c}\right ) & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e)),x)

[Out]

A*x/(2*a*c) + Piecewise((((8*I*A*a*c*f - 8*B*a*c*f)*exp(-2*I*f*x) + (-8*I*A*a*c*f*exp(4*I*e) - 8*B*a*c*f*exp(4
*I*e))*exp(2*I*f*x))*exp(-2*I*e)/(64*a**2*c**2*f**2), Ne(a**2*c**2*f**2*exp(2*I*e), 0)), (x*(-A/(2*a*c) + (A*e
xp(4*I*e) + 2*A*exp(2*I*e) + A - I*B*exp(4*I*e) + I*B)*exp(-2*I*e)/(4*a*c)), True))

________________________________________________________________________________________

Giac [A]
time = 0.55, size = 53, normalized size = 1.18 \begin {gather*} \frac {\frac {{\left (f x + e\right )} A}{a c} + \frac {A \tan \left (f x + e\right ) - B}{{\left (\tan \left (f x + e\right )^{2} + 1\right )} a c}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*((f*x + e)*A/(a*c) + (A*tan(f*x + e) - B)/((tan(f*x + e)^2 + 1)*a*c))/f

________________________________________________________________________________________

Mupad [B]
time = 8.45, size = 40, normalized size = 0.89 \begin {gather*} \frac {\frac {A\,\sin \left (2\,e+2\,f\,x\right )}{2}-\frac {B\,\cos \left (2\,e+2\,f\,x\right )}{2}+A\,f\,x}{2\,a\,c\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*tan(e + f*x))/((a + a*tan(e + f*x)*1i)*(c - c*tan(e + f*x)*1i)),x)

[Out]

((A*sin(2*e + 2*f*x))/2 - (B*cos(2*e + 2*f*x))/2 + A*f*x)/(2*a*c*f)

________________________________________________________________________________________